package controller.PurchaseTable;

import entity.MsgResult;
import entity.goods;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import service.UpdateGoodsService;

@Controller
public class UpdateGoodsController {

    @Autowired
    private UpdateGoodsService updateGoodsService;

    @RequestMapping("/updateGoods")
    @ResponseBody
    public MsgResult updateGoods(goods goods){
        MsgResult msgResult = new MsgResult();
        boolean b = updateGoodsService.updateGoods(goods);
        if(b){
            msgResult.setFlag(1);
            msgResult.setMsg("修改商品成功");
            return msgResult;
        }
        msgResult.setFlag(0);
        msgResult.setMsg("修改商品失败");
        return msgResult;
    }
}
